//
//  TzCollectionViewCell.m
//  quickBatchManager
//
//  Created by 王定波 on 15/10/9.
//  Copyright © 2015年 jack. All rights reserved.
//

#import "TzCollectionViewCell.h"

@implementation TzCollectionViewCell

- (void)awakeFromNib {
    // Initialization code
}


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        // 初始化时加载collectionCell.xib文件
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"TzCollectionViewCell" owner:self options:nil];
        
        // 如果路径不存在，return nil
        if (arrayOfViews.count < 1)
        {
            return nil;
        }
        // 如果xib中view不属于UICollectionViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])
        {
            return nil;
        }
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
        
        
        self.contentView.backgroundColor=[UIColor whiteColor];
        self.contentView.layer.cornerRadius=5;
        
//        self.contentView.layer.shadowRadius = 10.0;
//        self.contentView.layer.shadowColor = [UIColor blackColor].CGColor; //设置阴影的颜色为黑色
//        self.contentView.layer.shadowOpacity = 1.0; //设置阴影的不透明度
//        self.contentView.layer.shadowOffset = CGSizeMake(0, 3);
        
        
        
    }
    return self;
}



-(void)setData:(TzModel*)data
{
    if(data==nil)
    {
        for (UIView *view in self.contentView.subviews) {
            if (view.tag!=20) {
                view.hidden=YES;
            }
            else  view.hidden=NO;
        }
    }
    else
    {
        for (UIView *view in self.contentView.subviews) {
            if (view.tag!=20) {
                view.hidden=NO;
            }
            else  view.hidden=YES;
        }
    }
}


@end
